/*************************************************************************
 *                                                                       *
 * This file is part of the FreeMAPs distribution.  For full copyright   *
 * information, see COPYRIGHT and COPYING.LESSER.                        *
 *                                                                       *
 * Author:           sqbang                                              *
 * Email:            sqbang@ustc.edu                                     *
 * Date:             2011.10.11                                          *
 *                                                                       *
 *************************************************************************/

#ifndef FreeMAPs_include_COMMON_bdry_DirichletBoundaryCondition_h
#define FreeMAPs_include_COMMON_bdry_DirichletBoundaryCondition_h

#include "FreeMAPsConfig.h"

//COMMON headers
#include "COMMON/bdry/IrregularBoundaryConditionStrategy.h"

namespace FreeMAPs
{

//forward declaration
#ifdef FREEMAPS_HAVE_SAMRAI
class AttributeOfCell;
#endif
class Function;

/**
 * the boundary condition has the form of
 *   \f[ f=f_b \f]
 */
class DirichletBoundaryCondition : public IrregularBoundaryConditionStrategy
{
public:

    DirichletBoundaryCondition (
        const std::string& parent_name,
        const std::string& bc_name,
        const PDEEquationEnsembleStrategy* equation_ensemble);

    virtual
    ~DirichletBoundaryCondition();

public:

    /**
     * @return the boundary condition type
     */
    inline BoundaryConditionType
    get_type() const;

    inline bool
    require_set_variable() const;


private:

    void
    clear();

    void
    get_info_for_derived_object_from_input (
        const InputDatabase* db);

    std::string
    get_info_from_derived_object() const;


public:
#if 0
    //para constraint
    virtual void
    set_para_fb(
            gFreeMAPs::ParaFluxBean* para_fb);

    virtual gFreeMAPs::ParaFluxBean*
    get_para_fb();

#endif
private:

    typedef IrregularBoundaryConditionStrategy Parent;

    /*
     * when using interpolation to get the ghost cell's value.
     * the ghost cell can not too close to the boundary.
     * this is the tolerance to tells whether interpolation the ghost cell
     * or use boundary value directory.
     * if the distance between boundary_cell and boundary less than the tolerance,
     * then use the boundary value directly.
     */
    double d_use_interp_tol;

//    Function* d_para_fb;
    //gFreeMAPs::ParaFluxBean* d_para_flux;

private:

    DISALLOW_COPY_AND_ASSIGN (DirichletBoundaryCondition);
};

}

#include "COMMON/bdry/DirichletBoundaryCondition.inl"

#endif
